﻿#Region "Window Transitions"
'Case Keys.OemTilde
'    Select Case GameManager.UICommand.State
'        Case State.Opened
'            GameManager.UICommand.Hide()
'            Exit Select
'        Case State.Closed
'            GameManager.UICommand.Show()
'            Exit Select
'        Case State.Opening
'            Exit Select

'        Case State.Closing
'            Exit Select
'    End Select

'Public Enum State
'    Closed
'    Opening
'    Opened
'    Closing
'End Enum

'Public Class UICommand
'    Inherits DrawableGameComponent

'    Public Const OpenSpeed As Single = 0.1F
'    Public Const CloseSpeed As Single = 0.1F
'    Public State As State
'    Public Const MaxLineCount As Integer = 20
'    Public Const MaxCommandHistory As Integer = 32
'    Public Const Cursor As String = "_"
'    Public Const DefaultPrompt As String = "CMD>"
'    Public Prompt As String
'    Public stateTransition As Single
'    Public commandLine As String = ""
'    Public cursorIndex As Integer = 0
'    Public lines As New Queue(Of String)()
'    Public GameManager As GameManagerCollection

'    Public Sub New(Game As DanoQuest)
'        MyBase.New(Game)
'        Game.Components.Add(Me)
'        GameManager = Game.GameManager
'        Prompt = DefaultPrompt
'        DrawOrder = Integer.MaxValue
'    End Sub

'    Public Overrides Sub Initialize()
'        MyBase.Initialize()
'    End Sub

'    Public Overrides Sub Update(ByVal gameTime As GameTime)
'        MyBase.Update(gameTime)
'    End Sub

'    Public Sub Show()
'        If State = State.Closed Then
'            stateTransition = 0.0F
'            State = State.Opening
'        End If
'    End Sub

'    Public Sub Hide()
'        If State = State.Opened Then
'            stateTransition = 1.0F
'            State = State.Closing
'        End If
'    End Sub

'    Public Overrides Sub Draw(gameTime As GameTime)
'        Select Case GameManager.UICommand.State
'            Case State.Closed
'                Return
'            Case State.Opening
'                stateTransition += OpenSpeed
'                If stateTransition > 1.0F Then
'                    stateTransition = 1.0F
'                    State = State.Opened
'                End If
'                Exit Select
'            Case State.Opened
'                Exit Select
'            Case State.Closing
'                stateTransition -= CloseSpeed
'                If stateTransition < 0.0F Then
'                    stateTransition = 0.0F
'                    State = State.Closed
'                End If
'                Exit Select
'        End Select

'        Dim SpriteBatch As New SpriteBatch(Game.GraphicsDevice)
'        Dim font As SpriteFont = GameManager.UserInterface.SpriteFont
'        Dim w As Single = Game.GraphicsDevice.Viewport.Width
'        Dim h As Single = Game.GraphicsDevice.Viewport.Height
'        Dim topMargin As Single = h * 0.1F
'        Dim leftMargin As Single = w * 0.1F
'        Dim rect As New Rectangle()
'        rect.X = CInt(leftMargin)
'        rect.Y = CInt(topMargin)
'        rect.Width = CInt(w * 0.8F)
'        rect.Height = CInt(MaxLineCount * font.LineSpacing)
'        Dim mtx As Matrix = Matrix.CreateTranslation(New Vector3(0, -rect.Height * (1.0F - stateTransition), 0))
'        SpriteBatch.Begin(SpriteSortMode.Deferred, Nothing, Nothing, Nothing, Nothing, Nothing, mtx)
'        SpriteBatch.Draw(GameManager.UserInterface.WhiteTexture, rect, New Color(0, 0, 0, 200))
'        Dim pos As New Vector2(leftMargin, topMargin)
'        For Each line As String In lines
'            SpriteBatch.DrawString(font, line, pos, Color.White)
'            pos.Y += font.LineSpacing
'        Next
'        Dim leftPart As String = Prompt + commandLine.Substring(0, cursorIndex)
'        Dim cursorPos As Vector2 = pos + font.MeasureString(leftPart)
'        cursorPos.Y = pos.Y
'        SpriteBatch.DrawString(font, [String].Format("{0}{1}", Prompt, commandLine), pos, Color.White)
'        SpriteBatch.DrawString(font, Cursor, cursorPos, Color.White)
'        SpriteBatch.End()
'    End Sub
'End Class
#End Region

#Region "Event Calls"
'Sub txtMessageQueue_Damage(Sprite As Sprite, Damage As Integer) ' Handles Target.XEvent
'    ' GameManager.UserInterface.txtMessageQueue.Add(Sprite.Stats.Name & " hit " & Sprite.Target.Stats.Name & " for " & Damage.ToString & " damage.")
'    MsgBox("txtMessageQueue_Damage")
'End Sub
#End Region
